package com.tanhua.server.service;

import com.tanhua.server.enums.IdType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

@Service
public class IdService {
    @Autowired
    private RedisTemplate<String, String> redisTemplate;

    public Long createAutoId(IdType idType) {
        String redisKey = "TANHUA_ID_" + idType.toString();
        Long idKey = redisTemplate.opsForValue().increment(redisKey);
        return idKey;
    }
}
